package com.foogui.java8.stream;

import com.foogui.java8.utils.ListUtil;
import com.foogui.java8.vo.Dish;

import org.junit.Test;

import java.util.Arrays;
import java.util.List;
import java.util.stream.IntStream;


public class IntStreamDemo {
    @Test
    public void test01(){
        List<Dish> menu = ListUtil.createDishList();
        int sum = menu.stream().mapToInt(Dish::getCalories)
                .sum();
        System.out.println(sum);
    }
    @Test
    public void test02(){
        int[] ints = IntStream.range(1, 101)
                .toArray();
        System.out.println(Arrays.toString(ints));
    }
    @Test
    public void test03(){
        int portNumber = 1337;
        Runnable r = () -> System.out.println(portNumber);

    }
}
